/**
 * Created by alice on 2017/5/04 0001
 */
;-function (window) {
    "use strict";
    //TODO 预设变量写这里，全局变量写在base.js 里面 使用 r. 调用
    var ready = {
        layer: null,
        city: null,
        start: null,
        end: null,
        current_court_uid: null,
        case_type: null,
        _user: null,
        page_size: 12,
        on_time_type: null
    };
    //TODO 初始化的方法写这里面
    var init = function () {
        init_ready();//加载预设变量
        init_event();
        function init_event() {//TODO 初始化页面事件
            var current_day = utils.get_url_param(0);
            //查询的开始时间默认给今天
            $('#startTime').datetimepicker({
                bootcssVer: 3,
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                weekStart: "1",
                format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
                language: 'zh-CN', //汉化
                autoclose: true //选择日期后自动关闭
            }).on('changeDate', function (ev) {
                // console.log(ev.date.valueOf());
            });
            var end_time = $('#endTime');
            $('#endTime').datetimepicker({
                bootcssVer: 3,
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                weekStart: "1",
                format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
                language: 'zh-CN', //汉化
                autoclose: true //选择日期后自动关闭
            }).on('changeDate', function (ev) {
                // console.log(ev.date.valueOf());
            });

            if (null != ready.start && "" != ready.start) {
                $("#startTime").find("input").val(ready.start);
            } else {
                var temp = new Date();
                var defaultStartTime = temp.getFullYear() + "-01-01";
                $("#startTime").find("input").val(defaultStartTime);
            }
            if (null != ready.end) {
                end_time.find("input").val(ready.end);
            } else {
                end_time.find("input").val(current_day);
            }

            $("#selectAllChildCourts").change(function () {
                Class.all_child_option_change();
            });
            $(".container-fluid").show();

            //点击查询按钮
            $("#conditionBtn").click(function () {
                $("#loading").show();
                Class.get_sum_case();
            });
            if (ready.current_court_uid) {
                Class.init(ready.current_court_uid);
            } else {
                Class.init();
            }
        }

        function init_ready() {//TODO 初始化预设值
            layui.use('layer', function () {
                ready.layer = layui.layer;
            });
            ready.city = utils.get_url_param("city") || r.court_uid;
            ready.start = utils.get_url_param("start");
            ready.end = utils.get_url_param("end");
            ready.current_court_uid = utils.get_url_param("currentCourtUid");
            ready.case_type = utils.get_url_param("caseType");
            ready.on_time_type = utils.get_url_param("onTimeType");

        }
    };
    //TODO 内部调用的方法写这里
    var Class = {
        init: function (_court_uid) {
            ready.city = _court_uid ? _court_uid : r.court_uid;
            Class.select_all_child_courts();
            Class.select_all_court_room();
            Class.select_all_case_type();
            Class.select_all_ontime_type();
            Class.select_judge();
            Class.select_secretary();
            Class.get_sum_case();
        },
        get_sum_case: function () {
            if (r.flag_search) {
                Class.all_count_case_review();
            } else {
                Class.count_case_review();
            }
        },
        all_child_option_change: function () {
            var _current_court_id = $("#selectAllChildCourts").val();
            Class.select_all_court_room(_current_court_id);
            Class.select_all_case_type(_current_court_id);
            Class.select_all_ontime_type();
            Class.select_judge(_current_court_id);
            Class.select_secretary(_current_court_id);
            Class.get_sum_case();
        },
        select_all_child_courts: function () {
            var select_child_courts = $("#selectAllChildCourts");
            select_child_courts.empty();
            $.each(r.court_list, function (i, n) {
                select_child_courts.append("<option value='" + n.uid + "'>" + n.name + "</option>");
            });
            select_child_courts.val(ready.city);
        },
        select_all_court_room: function (current_court_uid) {
            if (current_court_uid) {
                ready.city = current_court_uid;
            }
            console.log(ready.city);
            var court_room = $("#allCourtRooms").empty();
            court_room.append("<option value=''>" + "所有法庭" + "</option>");
            $.each(courtroomList, function (i, valueOfElement) {
                court_room.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
            });
        },
        select_all_case_type: function (current_court_id) {
            $.ajaxSetup({
                async: false
            });
            if (current_court_id) {
                ready.city = current_court_id;
            }
            var case_type = $("#caseTypeName").empty();
            if (null != ready.case_type && '' != ready.case_type && 'null' != ready.case_type) {
                $.each(caseTypeList, function (i, valueOfElement) {
                    if (ready.case_type == valueOfElement.uid) {
                        case_type.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
                    }
                });
            } else {
                case_type.append("<option value=''>" + "所有类型" + "</option>");
                $.each(caseTypeList, function (i, valueOfElement) {
                    case_type.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
                });
            }
        },
        select_all_ontime_type: function () {
            console.info(onTimeTypeList, ready.on_time_type);
            var on_time_type = $("#onTimeTypeName").empty();
            if (null != ready.on_time_type && '' != ready.on_time_type && 'null' != ready.on_time_type) {
                $.each(onTimeTypeList, function (i, valueOfElement) {
                    if (ready.on_time_type == valueOfElement.uid) {
                        on_time_type.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
                    }
                });
            } else {
                on_time_type.append("<option value=''>" + "所有类型" + "</option>");
                $.each(onTimeTypeList, function (i, valueOfElement) {
                    on_time_type.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
                });
            }
        },
        select_judge: function (current_court_id) {
            $.ajaxSetup({
                async: false
            });
            if (current_court_id) {
                ready.city = current_court_id;
            }

            $.get(r.base_path + "caseCount/getJudgeAndSecretary", {
                courtUid: ready.city,
            }, function (result) {
                if (result.data) {
                    ready.judge_secretary_list = result.data;
                    // console.log(result);
                    var select_judge = $("#allJudges").empty();
                    select_judge.append("<option value=''>" + "所有法官" + "</option>");
                    $.each(result.data.judgeList, function (i, valueOfElement) {
                        select_judge.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
                    });
                }
            }, 'json');
        },
        select_secretary: function (current_court_id) {
            if (current_court_id) {
                ready.city = current_court_id;
            }
            if (ready.judge_secretary_list) {
                //console.log(result);
                var select_secretary = $("#allSecretary").empty();
                select_secretary.append("<option value=''>" + "所有书记员" + "</option>");
                $.each(ready.judge_secretary_list.secretaryList, function (i, valueOfElement) {
                    select_secretary.append("<option value='" + valueOfElement.uid + "'>" + valueOfElement.name + "</option>");
                });
            }
        },
        count_case_review: function (page) {
            if (!page) {
                page = 1;
            }
            //条件
            var onTimeType = $("#onTimeTypeName").val();
            var caseno = $("#caseno").val();
            var caseName = $("#caseName").val();
            var caseTypeName = $("#caseTypeName").val();
            var courtRoom = $("#allCourtRooms").val();
            var judge = $("#allJudges").val();
            var secretary = $("#allSecretary").val();
            var startTime = $("#startTime").find("input").val();
            var endTime = $("#endTime").find("input").val();
            var row_no_padding = $(".row-no-padding").empty();

            if (secretary == 'null') {
                secretary = null;
            }
            if (judge == 'null') {
                judge = null;
            }
            $.ajax({
                url: r.base_path + "review/selectOnTimeByConditions",
                type: "get",
                dataType: "json",
                data: {
                    archives: caseno,
                    caseName: caseName,
                    type: caseTypeName,
                    courtRoom: courtRoom,
                    judgeId: judge,
                    secretaryId: secretary,
                    startDate: startTime,
                    endDate: endTime,
                    courtUid: ready.city,
                    status: 0,
                    // review: 1,
                    page: page,
                    pageSize: ready.page_size,
                    onTimeType: onTimeType
                },
                success: function (result) {
                    // console.log(result.data);
                    var s = result.data.count;
                    if (s == 0) {
                        Class.page(1, 1, null);
                    } else {
                        Class.page(page, Math.ceil(s / 12), Class.count_case_review);
                    }
                    if (result.code == 0) {
                        if (result.data.count == 0) {
                            row_no_padding.append('<span>暂无开庭信息</span>');
                        } else {
                            var picNum = 6;
                            $.each(result.data.data, function (i, valueOfElement) {
                                var caseName = valueOfElement.name;
                                var startDate = valueOfElement.startDate;
                                var uid = valueOfElement.uid;
                                // var status = valueOfElement.status;
                                var courtroom_name = valueOfElement.courtroomName;
                                var cid = valueOfElement.courtroomUid;
                                var onTimeType = valueOfElement.onTimeType;
                                var delay_time = '';
                                if ("提前" == onTimeType) {
                                    delay_time = (0 - valueOfElement.delaytime) + "分";
                                } else if ("晚点" == onTimeType) {
                                    delay_time = valueOfElement.delaytime + "分";
                                }
                                // var statusName = "";
                                // if (0 == status) {
                                //     statusName = "排期";
                                // } else if (1 == status) {
                                //     statusName = "开庭";
                                // } else if (2 == status) {
                                //     statusName = "休庭";
                                // } else if (3 == status) {
                                //     statusName = "闭庭";
                                // } else {
                                //     statusName = "归档";
                                // }
                                var randomNum = parseInt(picNum * Math.random() + 1);//随机出1到picNum的整数
                                var href = r.base_path + "views/system_monitor/play.html?planId=" + uid + "&city=" + ready.city + "&vc=" + valueOfElement.courtId + '&court=' + r.court_id;
                                var html = '<div class="col-md-2 col-xs-6">' +
                                    '<div class="more-reviewing-item">' +
                                    '<a href="' + href + '">' +
                                    '<div class="more-reviewing-item-img-panel">' +
                                    '<p class="more-reviewing-item-img-panel-top">' + (courtroom_name ? courtroom_name : '未知') + '</p>' +
                                    '<img src="' + r.base_path + "assets/img/more_court_test" + randomNum + ".jpg" + '" alt="法院">' +
                                    '<p class="more-reviewing-item-img-panel-bottom">' + onTimeType + delay_time + '</p>' +
                                    '</div>' +
                                    '<p id="startDate">' + startDate + '</p>' +
                                    '<p id="caseNoDis">' + (valueOfElement.archives ? valueOfElement.archives : '未知') + '</p>' +
                                    '<p class="more-reviewing-item-depiction">' +
//                                    '<i class="fa fa-thumb-tack '+(valueOfElement.priorDate?'status-top':'')+'" title="置顶" id="'+uid + '..' + valueOfElement.courtId+'"></i>'+
                                    '<span>' + (caseName ? caseName : "&nbsp;") + '</span>' +
                                    '</p>' +
                                    '</a>' +
                                    '</div>' +
                                    '</div>';
                                row_no_padding.append(html);
                            });
                        }
                    }
                    $("#loading").hide();
                    row_no_padding.show();
                },
                error: function () {
                    $("#loading").hide();
                    layui.use('layer', function () {
                        layui.layer.msg("载入数据发生了问题");
                    });
                }
            });
        },
        select_case_review: function (page) {
            var caseno = $("#caseno").val();
            var caseName = $("#caseName").val();
            var caseTypeName = $("#caseTypeName").val();
            var onTimeTypeName = $("#onTimeTypeName").val();
            var courtRoom = $("#allCourtRooms").val();
            var judge = $("#allJudges").val();
            var secretary = $("#allSecretary").val();
            var startTime = $("#startTime").find("input").val();
            var endTime = $("#endTime").find("input").val();
            // console.log(caseName, caseTypeName, courtRoom, judge, secretary, startTime, endTime);
            if (secretary == 'null') {
                secretary = null;
            }
            if (judge == 'null') {
                judge = null;
            }
            var row_no_padding = $(".row-no-padding").empty();
            $.ajax({
                url: r.base_path + "trial/getOnTimeByCondition",
                type: "post",
                dataType: "json",
                data: {
                    caseno: caseno,
                    caseName: caseName,
                    caseTypeName: caseTypeName,
                    onTimeTypeName: onTimeTypeName,
                    courtRoom: courtRoom,
                    judge: judge,
                    secretary: secretary,
                    startTime: startTime,
                    endTime: endTime,
                    page: page,
                    pageSize: ready.page_size,
                    courtId: ready.city,
                    status: 1
                },
                success: function (result) {
                    // console.log(result);
                    //清空表格
                    if (result.status == 0) {

                        if (result.data.length == 0) {
                            row_no_padding.append('<span>暂无开庭信息</span>');
                        } else {
                            var picNum = 6;
                            $.each(result.data, function (i, valueOfElement) {
                                var caseName = valueOfElement.casename;
                                var startDate = new Date(valueOfElement.start_date);
                                var uid = valueOfElement.uid;
                                startDate = startDate.getFullYear() + "-" + (startDate.getMonth() + 1) + "-" + startDate.getDate() + " " + startDate.getHours() + ":" + startDate.getMinutes() + ":" + startDate.getSeconds();
                                var status = valueOfElement.status;
                                var courtroom_name = valueOfElement.courtroom_name;
                                var cid = valueOfElement.courtroom_id;
                                var onTimeType = valueOfElement.onTimeType;
                                var delay_time = '';
                                if ("提前" == onTimeType) {
                                    delay_time = (0 - valueOfElement.delaytime) + " 分";
                                } else if ("晚点" == onTimeType) {
                                    delay_time = valueOfElement.delaytime + " 分";
                                }
                                var statusName = "";
                                if (0 == status) {
                                    statusName = "排期";
                                } else if (1 == status) {
                                    statusName = "开庭";
                                } else if (2 == status) {
                                    statusName = "休庭";
                                } else if (3 == status) {
                                    statusName = "闭庭";
                                } else {
                                    statusName = "归档";
                                }
                                var randomNum = parseInt(picNum * Math.random() + 1);//随机出1到picNum的整数
                                var href = r.base_path + "views/system_monitor/play.html?planId=" + uid + "&city=" + ready.city + "&vc=" + valueOfElement.courtId + '&court=' + r.court_id;
                                var html = '<div class="col-md-2 col-xs-6">' +
                                    '<div class="more-reviewing-item">' +
                                    '<a href="' + href + '">' +
                                    '<div class="more-reviewing-item-img-panel">' +
                                    '<p class="more-reviewing-item-img-panel-top">' + (courtroom_name ? courtroom_name : '未知') + '</p>' +
                                    '<img src="' + r.base_path + "assets/img/more_court_test" + randomNum + ".jpg" + '" alt="法院">' +
                                    '<p class="more-reviewing-item-img-panel-bottom" >' + onTimeType + ' : ' + delay_time + '</p>' +
                                    '</div>' +
                                    '<p id="startDate">' + startDate + '</p>' +
                                    '<p id="caseNoDis">' + (valueOfElement.caseno ? valueOfElement.caseno : '未知') + '</p>' +
                                    '<p class="more-reviewing-item-depiction">' +
//                                    '<i class="fa fa-thumb-tack '+(valueOfElement.priorDate?'status-top':'')+'" title="置顶" id="'+uid + '..' + valueOfElement.courtId+'"></i>'+
                                    '<span>' + (caseName ? caseName : "&nbsp;") + '</span>' +
                                    '</p>' +
                                    '</a>' +
                                    '</div>' +
                                    '</div>';
                                row_no_padding.append(html);
                            });
                        }
                        $("#loading").hide();
                        row_no_padding.show();
                    }
                },
                error: function () {
                    $("#loading").hide();
                    layui.use('layer', function () {
                        layui.layer.msg("载入数据发生了问题");
                    });
                }
            });
        },
        all_count_case_review: function (page) {
            if (!page) {
                page = 1;
            }
            //条件
            var onTimeType = $("#onTimeTypeName").val();
            var caseno = $("#caseno").val();
            var caseName = $("#caseName").val();
            var caseTypeName = $("#caseTypeName").val();
            var courtRoom = $("#allCourtRooms").val();
            var judge = $("#allJudges").val();
            var secretary = $("#allSecretary").val();
            var startTime = $("#startTime").find("input").val();
            var endTime = $("#endTime").find("input").val();
            var row_no_padding = $(".row-no-padding").empty();

            if (secretary == 'null') {
                secretary = null;
            }
            if (judge == 'null') {
                judge = null;
            }
            $.ajax({
                url: r.base_path + "review/selectOnTimeByConditions",
                type: "get",
                dataType: "json",
                data: {
                    archives: caseno,
                    caseName: caseName,
                    type: caseTypeName,
                    courtRoom: courtRoom,
                    judgeId: judge,
                    secretaryId: secretary,
                    startDate: startTime,
                    endDate: endTime,
                    courtUid: ready.city,
                    status: 1,
                    // review: 1,
                    page: page,
                    pageSize: ready.page_size,
                    onTimeType: onTimeType
                },
                success: function (result) {
                    // console.log(result.data);
                    var s = result.data.count;
                    if (s == 0) {
                        Class.page(1, 1, null);
                        $('#loading').hide();
                    } else {
                        Class.page(page, Math.ceil(s / 12), Class.all_count_case_review);
                    }
                    if (result.code == 0) {
                        if (result.data.count == 0) {
                            row_no_padding.append('<span>暂无开庭信息</span>');
                        } else {
                            var picNum = 6;
                            $.each(result.data.data, function (i, valueOfElement) {
                                var caseName = valueOfElement.name;
                                var startDate = valueOfElement.startDate;
                                var uid = valueOfElement.uid;
                                // var status = valueOfElement.status;
                                var courtroom_name = valueOfElement.courtroomName;
                                var cid = valueOfElement.courtroomUid;
                                var onTimeType = valueOfElement.onTimeType;
                                var delay_time = '';
                                if ("提前" == onTimeType) {
                                    delay_time = (0 - valueOfElement.delaytime) + "分";
                                } else if ("晚点" == onTimeType) {
                                    delay_time = valueOfElement.delaytime + "分";
                                }
                                // var statusName = "";
                                // if (0 == status) {
                                //     statusName = "排期";
                                // } else if (1 == status) {
                                //     statusName = "开庭";
                                // } else if (2 == status) {
                                //     statusName = "休庭";
                                // } else if (3 == status) {
                                //     statusName = "闭庭";
                                // } else {
                                //     statusName = "归档";
                                // }
                                var randomNum = parseInt(picNum * Math.random() + 1);//随机出1到picNum的整数
                                var href = r.base_path + "views/system_monitor/play.html?planId=" + uid + "&city=" + ready.city + "&vc=" + valueOfElement.courtId + '&court=' + r.court_id;
                                var html = '<div class="col-md-2 col-xs-6">' +
                                    '<div class="more-reviewing-item">' +
                                    '<a href="' + href + '">' +
                                    '<div class="more-reviewing-item-img-panel">' +
                                    '<p class="more-reviewing-item-img-panel-top">' + (courtroom_name ? courtroom_name : '未知') + '</p>' +
                                    '<img src="' + r.base_path + "assets/img/more_court_test" + randomNum + ".jpg" + '" alt="法院">' +
                                    '<p class="more-reviewing-item-img-panel-bottom">' + onTimeType + delay_time + '</p>' +
                                    '</div>' +
                                    '<p id="startDate">' + startDate + '</p>' +
                                    '<p id="caseNoDis">' + (valueOfElement.archives ? valueOfElement.archives : '未知') + '</p>' +
                                    '<p class="more-reviewing-item-depiction">' +
//                                    '<i class="fa fa-thumb-tack '+(valueOfElement.priorDate?'status-top':'')+'" title="置顶" id="'+uid + '..' + valueOfElement.courtId+'"></i>'+
                                    '<span>' + (caseName ? caseName : "&nbsp;") + '</span>' +
                                    '</p>' +
                                    '</a>' +
                                    '</div>' +
                                    '</div>';
                                row_no_padding.append(html);
                            });
                        }
                    }
                    $("#loading").hide();
                    row_no_padding.show();
                },
                error: function () {
                    $("#loading").hide();
                    layui.use('layer', function () {
                        layui.layer.msg("载入数据发生了问题");
                    });
                }
            });
        },
        all_select_case_review: function (page) {
            $("#loading").show();
            var caseno = $("#caseno").val();
            var caseName = $("#caseName").val();
            var caseTypeName = $("#caseTypeName").val();
            var onTimeTypeName = $("#onTimeTypeName").val();
            var courtRoom = $("#allCourtRooms").val();
            var judge = $("#allJudges").val();
            var secretary = $("#allSecretary").val();
            var startTime = $("#startTime").find("input").val();
            var endTime = $("#endTime").find("input").val();
            // console.log(caseName, caseTypeName, courtRoom, judge, secretary, startTime, endTime);
            if (secretary == 'null') {
                secretary = null;
            }
            if (judge == 'null') {
                judge = null;
            }
            var row_no_padding = $(".row-no-padding").empty();
            $.ajax({
                url: r.base_path + "trial/getAllOnTimeByCondition",
                type: "get",
                dataType: "json",
                data: {
                    caseName: caseName,
                    caseTypeName: caseTypeName,
                    onTimeTypeName: onTimeTypeName,
                    courtRoom: courtRoom,
                    judge: judge,
                    secretary: secretary,
                    startTime: startTime,
                    endTime: endTime,
                    page: page,
                    pageSize: ready.page_size,
                    courtId: ready.city,
                    caseno: caseno,
                    status: 1
                },
                success: function (result) {
                    // console.log(result);
                    //清空表格
                    if (result.status == 0) {
                        if (result.data.length == 0) {
                            row_no_padding.append('<span>暂无开庭信息</span>');
                        } else {
                            var picNum = 6;
                            $.each(result.data, function (i, valueOfElement) {
                                var caseName = valueOfElement.casename;
                                var startDate = new Date(valueOfElement.start_date);
                                var uid = valueOfElement.uid;
                                startDate = startDate.getFullYear() + "-" + (startDate.getMonth() + 1) + "-" + startDate.getDate() + " " + startDate.getHours() + ":" + startDate.getMinutes() + ":" + startDate.getSeconds();
                                var status = valueOfElement.status;
                                var courtroom_name = valueOfElement.courtroom_name;
                                var cid = valueOfElement.courtroom_id;
                                var onTimeType = valueOfElement.onTimeType;
                                var delay_time = '';
                                if ("提前" == onTimeType) {
                                    delay_time = (0 - valueOfElement.delaytime) + "分";
                                } else if ("晚点" == onTimeType) {
                                    delay_time = valueOfElement.delaytime + "分";
                                }
                                var statusName = "";
                                if (0 == status) {
                                    statusName = "排期";
                                } else if (1 == status) {
                                    statusName = "开庭";
                                } else if (2 == status) {
                                    statusName = "休庭";
                                } else if (3 == status) {
                                    statusName = "闭庭";
                                } else {
                                    statusName = "归档";
                                }
                                var randomNum = parseInt(picNum * Math.random() + 1);//随机出1到picNum的整数
                                var href = r.base_path + "views/system_monitor/play.html?planId=" + uid + "&city=" + ready.city + "&vc=" + valueOfElement.courtId + '&court=' + r.court_id;
                                var html = '<div class="col-md-2 col-xs-6">' +
                                    '<div class="more-reviewing-item">' +
                                    '<a href="' + href + '">' +
                                    '<div class="more-reviewing-item-img-panel">' +
                                    '<p class="more-reviewing-item-img-panel-top">' + (courtroom_name ? courtroom_name : '未知') + '</p>' +
                                    '<img src="' + r.base_path + "assets/img/more_court_test" + randomNum + ".jpg" + '" alt="法院">' +
                                    '<p class="more-reviewing-item-img-panel-bottom">' + onTimeType + delay_time + '</p>' +
                                    '</div>' +
                                    '<p id="startDate">' + startDate + '</p>' +
                                    '<p id="caseNoDis">' + (valueOfElement.caseno ? valueOfElement.caseno : '未知') + '</p>' +
                                    '<p class="more-reviewing-item-depiction">' +
//                                    '<i class="fa fa-thumb-tack '+(valueOfElement.priorDate?'status-top':'')+'" title="置顶" id="'+uid + '..' + valueOfElement.courtId+'"></i>'+
                                    '<span>' + (caseName ? caseName : "&nbsp;") + '</span>' +
                                    '</p>' +
                                    '</a>' +
                                    '</div>' +
                                    '</div>';
                                row_no_padding.append(html);
                            });
                        }
                    }
                    $("#loading").hide();
                    row_no_padding.show();
                },
                error: function () {
                    $("#loading").hide();
                    layui.use('layer', function () {
                        layui.layer.msg("载入数据发生了问题");
                    });
                }
            });
        },
        page: function (now, totalPages, callback) {
            base.pagination('#_page', {
                currentPage: now,
                totalPages: totalPages,
                onPageClicked: function (page) {
                    callback(page);
                }
            });
        }
    };
    init();
    //TODO 对外公开的方法写在这里
    window.p = {
        get_sum_case: Class.get_sum_case
    };
}(window);
